#include<iostream>
#include<set>
#include<map>
#include<algorithm>
#include<vector>


using namespace std;
void use_set()
{
    map<string, size_t> word_count;
    set<string> excludes = {"zack", "joyce", "mongo"};

    auto iter_map = word_count.end();
    set<string>::iterator iter = excludes.end();
    //(*iter)
    cout<< "#################" << (*(--iter));
    string word;
    size_t count = 0;
    while (count <= 5)
    {
        cin >> word;
        count ++;
        
        if (excludes.find(word) == excludes.end())
        {
            word_count[word]++;
        }
    }

    for (const auto &val : word_count)
    {
        cout << "word is " << val.first << " counts are " << val.second << endl;
    }
}

void use_map(void)
{

    map<string,int>data_map;
    data_map["alang"] = 1;
    data_map["jiajia"] = 2;
    data_map["bihao"] = 4;
    data_map["jiang"] = 3;

    map<string,int>::iterator iter = data_map.begin();

    
    for(auto &pair : data_map)
    {
        cout << pair.first<<"  "<<pair.second<<endl;
    }
}

void use_multiset()
{
    vector<int> ivec;
    for (int i = 0; i < 10; i++)
    {
        ivec.push_back(i);
        //数据重复插入一次
        ivec.push_back(i);
    }

    set<int> iset(ivec.begin(), ivec.end());
    multiset<int> imulset(ivec.begin(), ivec.end());
    for_each(iset.begin(), iset.end(), [](const int &i)
             { cout << i << " "; });
    cout << endl;

    for_each(imulset.begin(), imulset.end(), [](const int &i)
             { cout << i << " "; });
    cout << endl;
}

int main(int argc, char const *argv[])
{
    use_map();
    return 0;
}
